package day07;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 说明:
 *
 * @author:SuZhongHe
 * @date:2023/2/20
 **/
public class CalTotalAvg {
    public static void main(String[] args) {
        double[] scores =enterData();
        double avg=calAvg(scores);
        System.out.println(avg);




    }
    public static double[] enterData( ) {

        Scanner scanner = new Scanner(System.in);
        double[] a = new double[6];
        for (int i = 0; i < 6; i++) {
            System.out.println("输入成绩第" + (i + 1) + "个分数");
            a[i] = scanner.nextDouble();
        }
        return a;
    }
    public static double calTotal(double[]scores){
        Arrays.sort(scores);
        for (int i = 0; i < scores.length; i++) {

        }
        double[]total1=new double[4];
        double sum=0.0;
        System.arraycopy(scores,1,total1,0,4);
        for (int i = 0; i < total1.length; i++) {
            sum+=total1[i];
        }
        return sum;
    }
    public static double  calAvg(double[]scores){
        double total=calTotal(scores);
        double avg=total/(scores.length-2);
        return avg;
    }


}
